<template>
  <el-dialog
    :title="title"
    :visible.sync="dialogVisible"
    width="900px"
    @close="close"
  >
    <el-descriptions
      border
      content-class-name="contentClass"
      label-class-name="labelClass"
    >
      <el-descriptions-item
        v-for="(item, index) in attrs"
        :key="index"
        :label="item.name"
      >
        {{ formData[item.namekey] }}
      </el-descriptions-item>
    </el-descriptions>
  </el-dialog>
</template>

<script>
  export default {
    data() {
      return {
        title: '详情',
        dialogVisible: false,
        formData: {},
        attrs: [
          {
            name: '血袋号',
            namekey: 'blood_id',
          },
          {
            name: '机器结果时间',
            namekey: 'time',
          },
          {
            name: '入库时间',
            namekey: 'created_at',
          },
          {
            name: '主侧',
            namekey: 'master',
          },
          {
            name: '次侧',
            namekey: 'secondary',
          },
          {
            name: '配血结果',
            namekey: 'result',
          },
          {
            name: '直抗',
            namekey: 'dat',
          },
        ],
      }
    },
    methods: {
      show(row) {
        this.formData = row
        this.dialogVisible = true
      },
      close() {
        this.formData = {}
      },
    },
  }
</script>

<style lang="scss" scoped></style>
